<template>
  <div class="backResult">
    <div class="partA" v-if="errMsg.icon == 0">
      <img class="partA-img" src="./err.png" alt="" />
      <p class="partA-p" @click="goBackBtn">待支付</p>
    </div>
    <div class="partA" v-if="errMsg.icon == 1">
      <img class="partA-img" src="./err.png" alt="" />
      <p class="partA-p" @click="goBackBtn">已取消</p>
    </div>
    <div class="partA" v-if="errMsg.icon == 2">
      <img class="partA-img" src="./ok.png" alt="" />
      <p class="partA-p" @click="goBackBtn">支付成功</p>
    </div>
  </div>
</template>

<script>
import $utils from '../../utils'

export default {
  data() {
    return {
      errMsg: {
        icon: 2,
      },
    }
  },
  mounted() {
    this.activity_orderDetail()
  },
  methods: {
    activity_orderDetail() {
      let order = $utils.urlQuery('order') || 1221
      this.$api.publicMobile.activity_orderDetail(null, '/' + order).then((res) => {
        setTimeout(() => {
          this.goBackBtn()
        }, 2000)
        // 支付状态 （0：待支付，1：已取消，2：成功支付）
        if (res.data) {
          this.errMsg.icon = res.data.payStatus
        }
      })
    },
    goBackBtn() {
      // uni.redirectTo({
      //   url: '/pages/integral/index?pageName=MinePage',
      // })
      sessionStorage.tabIndex = '1'
      location.replace('/')
    },
  },
}
</script>

<style lang="scss" scoped>
.backResult {
  .partA {
    text-align: center;
    padding-top: 100rpx;
    .partA-img {
      width: 150rpx;
    }
    .partA-p {
      padding: 30rpx 0;
      font-size: 34rpx;
    }
    .partA-p1 {
      font-size: 30rpx;
      color: #999;
    }
    .partA-btn {
      margin: 30rpx auto 0;
      width: 630rpx;
      height: 100rpx;
      line-height: 100rpx;
      background: var(--main-color);
      border-radius: 8px;
      color: #fff;
    }
  }
}
</style>
